/*
 *  Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  See the NOTICE file distributed with
 *  this work for additional information regarding copyright ownership.
 *  The ASF licenses this file to You under the Apache License, Version 2.0
 *  (the "License"); you may not use this file except in compliance with
 *  the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
/**
 * @author Oleg V. Khaschansky
 */
/**
 * This file is based on WGL headers and has been generated by the nativebridge tool.
 */

package org.apache.harmony.awt.nativebridge.windows;

import org.apache.harmony.awt.nativebridge.*;

/**
 * This file is based on WGL headers and has been generated by the nativebridge tool.
 */
public class WGL extends BasicLibWrapper {
    static WGL instance;

    public static synchronized WGL getInstance() {
        if (instance == null) {
            instance = new WGL();
        }
        return instance;
    }

    private WGL() {
        org.apache.harmony.awt.Utils.loadLibrary("Win32Wrapper");
        init();
    }

    private static native void init();

    public final long wglGetProcAddress(String param_0) {
        Int8Pointer _param_0 = null == param_0? null :  nb.createInt8Pointer(param_0, false);
        long tmp_0 = _param_0 == null ? 0 : _param_0.longLockPointer();
        long tmp_ret = wglGetProcAddress(tmp_0);
        if (_param_0 != null) {
            _param_0.unlock();
            _param_0.free();
        }
        return tmp_ret;
    }
    public final long wglGetProcAddress(Int8Pointer param_0) {
        long tmp_0 = param_0 == null ? 0 : param_0.longLockPointer();
        long tmp_ret = wglGetProcAddress(tmp_0);
        if (param_0 != null) {
            param_0.unlock();
        }
        return tmp_ret;
    }
    public final native long wglGetProcAddress(long param_0);

    public final native long wglCreateContext(long param_0);


    public static class HGLRC__ extends CommonStructWrapper {

        public static final int sizeof = 4;

        HGLRC__(boolean direct) {
            super(sizeof, direct);
        }
        HGLRC__(VoidPointer base) {
            super(base);
        }
        HGLRC__(long addr) {
            super(addr);
        }
        public final void set_unused(int val) {
            byteBase.setInt32(0, val);
        }
        public final int get_unused() {
            return byteBase.getInt32(0);
        }
        public int size() {
            return sizeof;
        }
    }

    public final HGLRC__ createHGLRC__(boolean direct) {
        return new HGLRC__(direct);
    }
    public final HGLRC__ createHGLRC__(VoidPointer base) {
        return new HGLRC__(base);
    }
    public final HGLRC__ createHGLRC__(long addr) {
        return new HGLRC__(addr);
    }

    public final int wglMakeCurrent(long param_0, WGL.HGLRC__ param_1) {
        long tmp_0 = param_1 == null ? 0 : param_1.longLockPointer();
        int tmp_ret = wglMakeCurrent(param_0, tmp_0);
        if (param_1 != null) {
            param_1.unlock();
        }
        return tmp_ret;
    }
    public final native int wglMakeCurrent(long param_0, long param_1);

    public final int wglDestroyPbufferARB(HPBUFFERARB__ param_0) {
        long tmp_0 = param_0 == null ? 0 : param_0.longLockPointer();
        int tmp_ret = wglDestroyPbufferARB(tmp_0);
        if (param_0 != null) {
            param_0.unlock();
        }
        return tmp_ret;
    }
    public final native int wglDestroyPbufferARB(long param_0);


    public static class HPBUFFERARB__ extends CommonStructWrapper {

        public static final int sizeof = 4;

        HPBUFFERARB__(boolean direct) {
            super(sizeof, direct);
        }
        HPBUFFERARB__(VoidPointer base) {
            super(base);
        }
        HPBUFFERARB__(long addr) {
            super(addr);
        }
        public final void set_unused(int val) {
            byteBase.setInt32(0, val);
        }
        public final int get_unused() {
            return byteBase.getInt32(0);
        }
        public int size() {
            return sizeof;
        }
    }

    public final HPBUFFERARB__ createHPBUFFERARB__(boolean direct) {
        return new HPBUFFERARB__(direct);
    }
    public final HPBUFFERARB__ createHPBUFFERARB__(VoidPointer base) {
        return new HPBUFFERARB__(base);
    }
    public final HPBUFFERARB__ createHPBUFFERARB__(long addr) {
        return new HPBUFFERARB__(addr);
    }

    public final native int SwapBuffers(long param_0);

    public final int wglReleasePbufferDCARB(WGL.HPBUFFERARB__ param_0, long param_1) {
        long tmp_0 = param_0 == null ? 0 : param_0.longLockPointer();
        int tmp_ret = wglReleasePbufferDCARB(tmp_0, param_1);
        if (param_0 != null) {
            param_0.unlock();
        }
        return tmp_ret;
    }
    public final native int wglReleasePbufferDCARB(long param_0, long param_1);

    public final WGL.HPBUFFERARB__ wglCreatePbufferARB(long param_0, int param_1, int param_2, int param_3, Int32Pointer param_4) {
        long tmp_0 = param_4 == null ? 0 : param_4.longLockPointer();
        long tmp_ret = wglCreatePbufferARB(param_0, param_1, param_2, param_3, tmp_0);
        if (param_4 != null) {
            param_4.unlock();
        }
        return WGL.instance.createHPBUFFERARB__(tmp_ret);
    }
    public final native long wglCreatePbufferARB(long param_0, int param_1, int param_2, int param_3, long param_4);

    public final int wglQueryPbufferARB(WGL.HPBUFFERARB__ param_0, int param_1, Int32Pointer param_2) {
        long tmp_0 = param_0 == null ? 0 : param_0.longLockPointer();
        long tmp_1 = param_2 == null ? 0 : param_2.longLockPointer();
        int tmp_ret = wglQueryPbufferARB(tmp_0, param_1, tmp_1);
        if (param_0 != null) {
            param_0.unlock();
        }
        if (param_2 != null) {
            param_2.unlock();
        }
        return tmp_ret;
    }
    public final native int wglQueryPbufferARB(long param_0, int param_1, long param_2);

    public final int wglDeleteContext(WGL.HGLRC__ param_0) {
        long tmp_0 = param_0 == null ? 0 : param_0.longLockPointer();
        int tmp_ret = wglDeleteContext(tmp_0);
        if (param_0 != null) {
            param_0.unlock();
        }
        return tmp_ret;
    }
    public final native int wglDeleteContext(long param_0);

    public final native long wglGetExtensionsStringARB(long param_0);

    public final int wglChoosePixelFormatARB(long param_0, Int32Pointer param_1, FloatPointer param_2, int param_3, Int32Pointer param_4, Int32Pointer param_5) {
        long tmp_0 = param_1 == null ? 0 : param_1.longLockPointer();
        long tmp_1 = param_2 == null ? 0 : param_2.longLockPointer();
        long tmp_2 = param_4 == null ? 0 : param_4.longLockPointer();
        long tmp_3 = param_5 == null ? 0 : param_5.longLockPointer();
        int tmp_ret = wglChoosePixelFormatARB(param_0, tmp_0, tmp_1, param_3, tmp_2, tmp_3);
        if (param_1 != null) {
            param_1.unlock();
        }
        if (param_2 != null) {
            param_2.unlock();
        }
        if (param_4 != null) {
            param_4.unlock();
        }
        if (param_5 != null) {
            param_5.unlock();
        }
        return tmp_ret;
    }
    public final native int wglChoosePixelFormatARB(long param_0, long param_1, long param_2, int param_3, long param_4, long param_5);

    public final int wglShareLists(WGL.HGLRC__ param_0, WGL.HGLRC__ param_1) {
        long tmp_0 = param_0 == null ? 0 : param_0.longLockPointer();
        long tmp_1 = param_1 == null ? 0 : param_1.longLockPointer();
        int tmp_ret = wglShareLists(tmp_0, tmp_1);
        if (param_0 != null) {
            param_0.unlock();
        }
        if (param_1 != null) {
            param_1.unlock();
        }
        return tmp_ret;
    }
    public final native int wglShareLists(long param_0, long param_1);

    public final long wglGetPbufferDCARB(WGL.HPBUFFERARB__ param_0) {
        long tmp_0 = param_0 == null ? 0 : param_0.longLockPointer();
        long tmp_ret = wglGetPbufferDCARB(tmp_0);
        if (param_0 != null) {
            param_0.unlock();
        }
        return tmp_ret;
    }
    public final native long wglGetPbufferDCARB(long param_0);

}

